import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import ElementPlus from "element-plus";
import "element-plus/lib/theme-chalk/index.css";
import "../src/assets/style.css"
import http from './http';
const app = createApp(App);
app.config.globalProperties.$http = http;
app.use(ElementPlus).use(store).use(router).mount("#app");
//上传图片模块因为缺少token，验证失败，所以添加获取token的方法
app.mixin({
    computed: {
        uploadUrl() {
            return this.$http.defaults.baseURL + '/upload'
        }
    },
    methods: {
        getAuthHeaders() {
            return {
                Authorization: `Bearer ${localStorage.token || ''}`
            }
        }
    }
})